package Frame.battleanimation;

import FCRendering.FCRConstants;
import FCRendering.FCRMaster;
import VWorldGameStudio.FCPlayerBattleWrap;

import java.awt.*;

import static FCRendering.FCRMaster.fcv;

public class NpcJoinBattleAni extends ABattleAni{
//基本是为了红狼定身而做的，下面参数都写死调试了

    public String npcName;
    private int targetPox = 1420;
    private int targetPoy = 700;

    FCPlayerBattleWrap wrap;
    private int[] resultPoint = new int[2];

    private int[] endPoint = new int[2];
    private int[] startPoint = new int[2];

    public NpcJoinBattleAni(String name){
        this.npcName = name;
        int v = (int) (100*fcv.getProportion());//速度200像素
        allFrames = (int)(16*(1920 - targetPox)*fcv.getProportion()/v);
        wrap = FCPlayerBattleWrap.findBattleWrapByName("npc", npcName);
        wrap.setCoorY((int)(targetPoy*fcv.getProportion()));
        wrap.setCoorX((int)(1920*fcv.getProportion()));
        startPoint[0] = wrap.getCoorX();
        startPoint[1] = wrap.getCoorY();
        endPoint[0] = (int)(targetPox*fcv.getProportion());
        endPoint[1] = wrap.getCoorY();
        System.out.println("allFrames = "+allFrames);
    }


    @Override
    public void nextFrame(int frame) {
        AnimationUtil.getAnimatePoint(resultPoint, startPoint, endPoint, (float) frame / allFrames);
        wrap.setCoorY(resultPoint[1]);
        wrap.setCoorX(resultPoint[0]);

        if (frame == 5) {
            fcv.getMessage().add("  男子加入了战斗" );
            fcv.showMessage();
        }
    }

    @Override
    public void paintBattleSceen(Graphics g, FCRMaster fcrMaster) {

    }
}
